Telegram Group & Telegram Channel
Специальная переменная __name__

Когда интерпретатор Python читает файл, то сначала он устанавливает несколько специальных переменных (пример). Одной из таких переменных является __name__.

Если скрипт был запущен напрямую, то в переменную присваивается значение __main__, в случае импорта — название модуля.

Типичный пример использования такой переменной — создание точки входа в программу. Про это уже был ранее пост.

Вообще атрибут __name__ по умолчанию также ставится всем классам и функциям.

#переменные



tg-me.com/python_academy/643
Create:
Last Update:

Специальная переменная __name__

Когда интерпретатор Python читает файл, то сначала он устанавливает несколько специальных переменных (пример). Одной из таких переменных является __name__.

Если скрипт был запущен напрямую, то в переменную присваивается значение __main__, в случае импорта — название модуля.

Типичный пример использования такой переменной — создание точки входа в программу. Про это уже был ранее пост.

Вообще атрибут __name__ по умолчанию также ставится всем классам и функциям.

#переменные

BY Python Academy




Share with your friend now:
tg-me.com/python_academy/643

View MORE
Open in Telegram


Python Academy Telegram | DID YOU KNOW?

Date: |

How To Find Channels On Telegram?

There are multiple ways you can search for Telegram channels. One of the methods is really logical and you should all know it by now. We’re talking about using Telegram’s native search option. Make sure to download Telegram from the official website or update it to the latest version, using this link. Once you’ve installed Telegram, you can simply open the app and use the search bar. Tap on the magnifier icon and search for a channel that might interest you (e.g. Marvel comics). Even though this is the easiest method for searching Telegram channels, it isn’t the best one. This method is limited because it shows you only a couple of results per search.

The S&P 500 slumped 1.8% on Monday and Tuesday, thanks to China Evergrande, the Chinese property company that looks like it is ready to default on its more-than $300 billion in debt. Cries of the next Lehman Brothers—or maybe the next Silverado?—echoed through the canyons of Wall Street as investors prepared for the worst.

Python Academy from ua


Telegram Python Academy
FROM USA